package org.jeecg.modules.comment.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.comment.entity.PhilComment;
import org.jeecg.modules.comment.vo.CommentPublish;

import java.util.List;

/**
 * @Description: 评论
 * @Author: jeecg-boot
 * @Date:   2020-11-12
 * @Version: V1.0
 */
public interface PhilCommentMapper extends BaseMapper<PhilComment> {

    /**
     * TODO: 根据文章id  分页查询  所有被发布了的评论
     *
     *
     * @author ZhangHaoyu
     * @param pageList  分页用的
     * @param articleId  文章id
     * @return java.util.List<org.jeecg.modules.comment.vo.CommentPublish>
     */
    List<CommentPublish> queryPublishListPage(Page<CommentPublish> pageList,@Param("articleId") String articleId);

    /**
     * TODO: 分页查询 根据用户openid获取所有评论
     *
     *
     * @author ZhangHaoyu
     * @param pageList 分页
     * @param openId 用户openId
     * @return java.util.List<org.jeecg.modules.comment.vo.CommentPublish>
     */
    List<CommentPublish> queryListPageByOpenId(Page<CommentPublish> pageList, @Param("openId") String openId);

    /**
     * TODO: 根据知识id获取知识标题
     *
     * @author: Zhang hao yu
     * @param knowledgeId
     * @return: java.lang.String
     */
    @Select("select knowledge_title from phil_knowledge where id = #{knowledgeId}")
    String getTitle(@Param("knowledgeId") String knowledgeId);
}
